/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author nivri
 */
@Entity
@Table(name = "colaboradores")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Colaboradores.findAll", query = "SELECT c FROM Colaboradores c"),
    @NamedQuery(name = "Colaboradores.findById", query = "SELECT c FROM Colaboradores c WHERE c.id = :id"),
    @NamedQuery(name = "Colaboradores.findByliked", query = "SELECT c FROM Colaboradores c WHERE CONCAT( c.codigoCol, \" \", c.nombres, \" \", c.apellidos) like :nombres "),
    @NamedQuery(name = "Colaboradores.findByCodigoCol", query = "SELECT c FROM Colaboradores c WHERE c.codigoCol = :codigoCol"),
    @NamedQuery(name = "Colaboradores.findByNombres", query = "SELECT c FROM Colaboradores c WHERE c.nombres = :nombres"),
    @NamedQuery(name = "Colaboradores.findByApellidos", query = "SELECT c FROM Colaboradores c WHERE c.apellidos = :apellidos")})
public class Colaboradores implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 36)
    @Column(name = "id")
    private String id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 36)
    @Column(name = "codigo_col")
    private String codigoCol;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nombres")
    private String nombres;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "apellidos")
    private String apellidos;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkCol")
    private List<DiaslibresCol> diaslibresColList;

    @Transient
    private String nombrecompleto;

    public String getNombrecompleto() {
        nombrecompleto = getNombres() +" "+getApellidos();
        return nombrecompleto;
    }

    public void setNombrecompleto(String nombrecompleto) {
        this.nombrecompleto = nombres +" "+apellidos;
    }
    public Colaboradores() {
    }

    public Colaboradores(String id) {
        this.id = id;
    }

    public Colaboradores(String id, String codigoCol, String nombres, String apellidos) {
        this.id = id;
        this.codigoCol = codigoCol;
        this.nombres = nombres;
        this.apellidos = apellidos;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCodigoCol() {
        return codigoCol;
    }

    public void setCodigoCol(String codigoCol) {
        this.codigoCol = codigoCol;
    }

    public String getNombres() {
        return nombres;
    }

    public void setNombres(String nombres) {
        this.nombres = nombres;
    }

    public String getApellidos() {
        return apellidos;
    }

    public void setApellidos(String apellidos) {
        this.apellidos = apellidos;
    }

    @XmlTransient
    public List<DiaslibresCol> getDiaslibresColList() {
        return diaslibresColList;
    }

    public void setDiaslibresColList(List<DiaslibresCol> diaslibresColList) {
        this.diaslibresColList = diaslibresColList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Colaboradores)) {
            return false;
        }
        Colaboradores other = (Colaboradores) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Colaboradores[ id=" + id + " ]";
    }
    
}
